import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
import 'nprogress/nprogress.css';
import Home from '../view/home.vue';
const routes: Array<RouteRecordRaw>= [{
    path: '/',
    redirect: '/login',
}, {
    path: '/',
    name: 'Home',
    component: Home,
    children:[
        {
            path: '/home',
            name: 'home',
            meta: {
                title: '系统首页'
            },
            component: () => import('../view/home/index.vue')
        },
        {
            path: '/system-user',
            name: 'system-user',
            meta: {
                title: '用户管理',
                permiss: '11',
            },
            component: () => import(/* webpackChunkName: "system-user" */ '../view/system/user.vue'),
        },
        {
            path: '/system-role',
            name: 'system-role',
            meta: {
                title: '角色管理',
                permiss: '12',
            },
            component: () => import(/* webpackChunkName: "system-role" */ '../view/system/role.vue'),
        },
        {
            path: '/system-menu',
            name: 'system-menu',
            meta: {
                title: '菜单管理',
                permiss: '13',
            },
            component: () => import(/* webpackChunkName: "system-menu" */ '../view/system/menu.vue'),
        }
    ]
},
{
    path: '/login',
    meta: {
        title: '登录页'
    },
    component: () => import('../view/home/login.vue')
},{
    path: '/reset-pwd',
    meta: {
        title: '重置密码'
    },
    component: () => import('../view/home/reset-pwd.vue')
}


]
const router = createRouter({
    history: createWebHashHistory(),
    routes,
});



// router.beforeEach((to, from, next) => {
//     NProgress.start();
//     next();
// });

// router.afterEach(() => {
//     NProgress.done();
// });


export default router;
